
<?php
/** @var IncidenciaController $this */
/** @var Incidencia $model */
/** @var AweActiveForm $form */
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
//plugin select2
Util::tsRegisterAssetJs('_form_modal_cargos.js');
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'templeado-form',
    'enableAjaxValidation' => false,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));

$mensaje = $model->isNewRecord ? "Aplicar Cargos" : "Actualizar Cargo";
?>
<script>
    var $cap_idCargos = "<?php print !(count($cap_idCargos) == 0) ? true : false; ?>";
    var $cav_idCargos = "<?php print !(count($cav_idCargos) == 0) ? true : false;
;
?>";

</script>
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-fire-extinguisher"></i> <?php echo $mensaje ?></h4>
</div>
<div class="modal-body">
    <p class="note">
        <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
<?php echo Yii::t('AweCrud.app', 'are required') ?>.    </p>
    <label class="control-label required" for="tipo">Tipos de Cargos </label>

    <div class="controls">
        <?php
        $this->widget(
                'ext.bootstrap.widgets.TbToggleButton', array(
            'model' => $model,
            'disabledLabel' => 'Proyectos ',
            'enabledLabel' => 'Titulos Obtenidos',
            'width' => 200,
            'attribute' => 'tipo',
            'onChange' => 'js:function($el, status, e){tipoMostrar(status)}'
                )
        );
        ?>

    </div>
    <div id ="tipotitulos" class="hidden">
        <?php echo $form->labelEx($model, 'cap_id') ?>
        <?php
        $lista_cargos_Html = !(count($cap_idCargos) == 0) ? array(0 => '- Seleccione -') + CHtml::listData($cap_idCargos, 'cap_id', 'cap_descripcion') : array(0 => '- No Existen Cargos Disponibles -');
        $this->widget(
                'ext.bootstrap.widgets.TbSelect2', array(
            'asDropDownList' => TRUE,
            'model' => $model,
            'attribute' => 'cap_id',
            'data' => $lista_cargos_Html,
            'events' => array("event_name" => "Javascript code for handler"),
            'options' => array(
                'placeholder' => 'type clever, or is, or just type!',
                'width' => '50%',
            )
                )
        );
        ?>
<?php echo $form->error($model, 'cap_id'); ?>
    </div>
    <div id ="tipoproyectos" class="">
        <?php echo $form->labelEx($model, 'cav_id') ?>
        <?php
        $lista_cargos_cav_Html = !(count($cav_idCargos) == 0) ? array(0 => '- Seleccione -') + CHtml::listData($cav_idCargos, 'cav_id', 'cav_descripcion') : array(0 => '- No Existen Cargos Disponibles -');
        $this->widget(
                'ext.bootstrap.widgets.TbSelect2', array(
            'asDropDownList' => TRUE,
            'model' => $model,
            'attribute' => 'cav_id',
            'data' => $lista_cargos_cav_Html,
            'events' => array("event_name" => "Javascript code for handler"),
            'options' => array(
                'placeholder' => 'type clever, or is, or just type!',
                'width' => '50%',
            )
                )
        );
        ?>
    </div>
    <?php // echo $form->textFieldRow($model, 'emp_observaciones', array('maxlength' => 60)) ?>
    <?php echo $form->hiddenField($model, 'per_id') ?>
    <?php echo $form->hiddenField($model, 'existecav_id') ?>
    <?php echo $form->hiddenField($model, 'existecap_id') ?>
    <?php echo $form->textFieldRow($model, 'ees_id') ?>
<?php echo $form->textFieldRow($model, 'per_id') ?>

</div>
<div class="modal-footer">
    <?php
    if (!count($cap_idCargos) == 0 || !count($cav_idCargos) == 0) {
        $this->widget('bootstrap.widgets.TbButton', array(
            'type' => 'success',
            'icon' => 'ok',
            'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
            'htmlOptions' => array(
                'onClick' => 'js:ajaxSaveCargos("#templeado-form");')
        ));
    }
    ?>
    <?php
    $this->widget('bootstrap.widgets.TbButton', array(
        'icon' => 'remove',
        'label' => Yii::t('AweCrud.app', 'Cerrar'),
        'htmlOptions' => array('data-dismiss' => 'modal')
    ));
    ?>
</div>





<?php $this->endWidget(); ?>
